<template>
    <div id="inventGroupManage" class="center_div">
        <div class="searchForm searchFormDataManageBtn22px" style="margin-top: 1%;margin-left: 1%;">
            <el-form :inline="true"  class="demo-form-inline">
                <el-form-item label="编组">
                    <el-input v-model="name"></el-input>

                </el-form-item>
                <el-form-item>
                    <el-button type="primary"  @click="querySearch"class="dataManageBtn22BtnpPx">查询</el-button>
                    <el-button type="primary"  @click="add"class="dataManageBtn22BtnpPx">添加</el-button>
                </el-form-item>
            </el-form>
        </div>

        <div class="table-wrap">
            <el-table
                    :data="tableData"
                    style="width:100%;text-align: center;"
                    border
                    cell-class-name="dataManage18px"
                    :header-cell-style="headerCellClassName">
                <el-table-column  align="center"v-for="title in tableTitle" :prop="title.prop" :label="title.label"
                                 :show-overflow-tooltip="title.overflowTooltip">
                </el-table-column>
                <template v-if="buttons && buttons.length!==0">
                    <el-table-column
                            class="align-right"
                            width="320"
                            header-align="center"
                            label="操作"
                            align="center" >
                        <template slot-scope="scope">
                            <el-button v-for="button in buttons"
                                       @click="operate(scope.row,button.href)" :type="button.type"
                                       class="el-button el-button--text dataManageBtn22px">{{button.label}}
                            </el-button>
                        </template>
                    </el-table-column>
                </template>
            </el-table>
            <el-pagination
                    class="dataManage18px"
                    layout="total,prev, pager,next"
                    background
                    @current-change="changePageNum"
                    :current-page="pageNum"
                    :page-size="pageSize"
                    :total="total">
            </el-pagination>
        </div>
        <div>
            <el-dialog :title="title"
                       :visible.sync="showBox"
                       width="40%"
                       @close="closeDialog"
                       append-to-body>
                <el-form ref="form" :model="form" :rules="rules" label-width="160px" >
                    <el-row>
                        <el-col :span="22">
                            <el-form-item label="编组" prop="name">
                                <el-input v-model="form.name"></el-input>
                            </el-form-item>
                        </el-col>

                    </el-row>

                    <el-row>
                        <el-col :span="22">
                            <el-form-item label="IP分机号码" prop="extNumber" >
                                <el-input v-model="form.extNumber" type="number" :min="0"
                                          onKeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="22">
                            <el-form-item label="描述" prop="remark">
                                <el-input v-model="form.remark" type="textarea"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button @click="closeBox" class="dataManageBtn22BtnpPx">取消</el-button>
                    <el-button type="primary"  @click="addInventGroup" v-show="showAdd"class="dataManageBtn22BtnpPx">添加
                    </el-button>
                    <el-button type="primary"  @click="updateInventGroup" v-show="!showAdd"class="dataManageBtn22BtnpPx">修改
                    </el-button>
                </div>
            </el-dialog>
        </div>
        <el-dialog v-if="loadTree"
                   :title="chooseForm.title"
                   :visible.sync="chooseForm.seen"
                   width="70%"
                   @close="closeTreeDialog"

                   append-to-body>
                    <div class="groupMgStyleBigBoxLeft">
                        <div style="height:99%;width:99%;margin-top:1%;background:white;overflow:auto">
                        <el-tree check-strictly
                                 :load="loadChildren"
                                 show-checkbox
                                 highlight-current
                                 lazy
                                 node-key="id"
                                 :props="chooseForm.defaultProps"
                                 :filter-node-method="filterNode"
                                 ref="tree"
                                 @check-change="handleLeftCheckChange">
                              <span class="custom-tree-node dataManage18px" slot-scope="{ node, data }">
                            <span v-if="data.type===0"><img src="@/assets/images/mapicon/tree_fleet.png"
                                                            class="treeLableImg">{{ node.label }}</span>
                            <span v-if="data.type===1"><img src="@/assets/images/mapicon/tree_fleet.png"
                                                            class="treeLableImg">{{ node.label }}</span>
                            <span v-if="data.type===2"><img src="@/assets/images/mapicon/tree_sub.png"
                                                            class="treeLableImg">{{ node.label }}</span>
                            <span v-if="data.type===3"><img src="@/assets/images/mapicon/tree_sub.png"
                                                            class="treeLableImg">{{ node.label }}</span>
                        </span>
                        </el-tree>
                        </div>
                    </div>
                    <div class="groupMgStyleBigBox">
                        <el-table
                                :data="chooseForm.rightList"
                                style="width:100%;text-align: center;"
                                border
                                class="groupMgTableClass"
                                cell-class-name="memberMgdataManageText"
                                :header-cell-style="headerCellClassName">
                            <el-table-column align="center" v-for="title in memberTableDataTableTitle" :prop="title.prop" :label="title.label"  :show-overflow-tooltip="title.overflowTooltip">
                            </el-table-column>
                            <template>
                                <el-table-column
                                        class="align-right"
                                        width="230px"
                                        align="center"
                                        label="操作">
                                    <template slot-scope="scope">
                                        <!--<span><img src="@/assets/images/newIcon/sortUp.png"
                                                   class="groupMgStyle"
                                                   @click="sortUpUp(index)">
                                        </span>-->
                                        <span>
                                        <el-button @click="deleteRightMember(scope.row.id)" type="text"
                                                   class="el-button el-button--text  memberMgdataManageBtn">删除</el-button></span>
                                    </template>
                                </el-table-column>
                            </template>
                        </el-table>
                        <el-pagination
                                v-if="false"
                                class="dataManage18px"
                                layout="total,prev, pager, next"
                                background
                                @current-change="changesAddPageNum"
                                :current-page="addPage.pageNum"
                                :page-size="addPage.pageSize"
                                :total="chooseForm.rightList.length">
                        </el-pagination>
                    </div>
                <!--<div style="float:right;width:40%;height:90%;background: ghostwhite;overflow: auto">
                    <div>
                        <div class="split-line">已选择</div>
                    </div>
                    <el-row v-for="item in chooseForm.rightList" :key="item.id" style="padding: 3px">
                        <el-col :span="16" style="padding-top: 5px;" class="dataManage18px">
                                <span :title="item.name" style="width:80px;text-overflow:ellipsis">
                                   {{item.name}}
                                </span>
                        </el-col>
                        <el-col :span="5">
                            <el-button @click="deleteRightMember(item.id)"
                                       class="el-button el-button&#45;&#45;text dataManage16px">删除
                            </el-button>
                        </el-col>
                    </el-row>
                </div>-->

            <div slot="footer" class="dialog-footer">
                <el-button  @click="chooseForm.seen = false"class="dataManageBtn22BtnpPx">取 消</el-button>
                <el-button  type="primary" @click="resModify"class="dataManageBtn22BtnpPx">确 定</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
  import InventGroupManage from '@/api/dataManages/InventGroupManage';

  export default {
    name: 'InventGroupManage',
    props: {
      FleetId: Number,
      userId: Number,
      UserAccount: String,
    },
    data() {
      return {
        name: '',
        loadTree: true,
        tableTitle: [
          {label: '编组', prop: 'name', overflowTooltip: true},
          {label: '分机号', prop: 'extNumber', overflowTooltip: true},
          //    {label: '部门', prop: 'fleetName'},
          {label: '描述', prop: 'remark', overflowTooltip: true},
        ],
        rules: {
          name: [
            {required: true, message: '请输入虚拟组名称', trigger: 'blur'},
            {min: 1, max: 30, message: '长度在 1 到 30 个字符', trigger: 'blur'},
          ], extNumber: [
            {required: true, message: '请输入IP分机号码', trigger: 'blur'},
          ], fleetName: [
            {required: true, message: '请选择部门', trigger: 'blur'},
          ], remark: [
            {required: false, message: '请选择部门', trigger: 'blur'},
            {min: 1, max: 128, message: '长度不能超过128个字符', trigger: 'blur'},
          ],
        },
        tableData: [],
        memberTableTitle: [
          {label: '成员', prop: 'subName'},
          {label: '归属部门', prop: 'fleetName'},
          {label: '编组', prop: 'groupName'},
        ],
        memberTableData: [],
        total: 0,
        pageNum: 1,
        pageSize: 8,
        addPage:{
          total: 0,
          pageNum: 1,
          pageSize: 4,
        },
        buttons: [
          {label: '编辑', href: 'update'}, {label: '删除', href: 'delete'}, {
            label: '成员管理',
            href: 'manage',
          }],

        extNumberOptions: [],

        showBox: false,
        showAdd: true,
        title: '',
        form: {
          id: '',
          name: '',
          fleetName: '',
          fleetId: '',
          remark: '',
          extNumber: '',
        },
        chooseForm: {
          seen: false,
          title: '成员管理',
          leftList: [],
          rightList: [],
          type: 0, //0- 新增资源   1- 新增群组人员
          groupId: 0,
          defaultProps: {
            label: 'name',
            isLeaf: 'isLeaf',
          },
        },
        memberTableDataTableTitle: [
          {label: '终端名称', prop: 'name',overflowTooltip:true},
          {label: '分机号', prop: 'extnum',overflowTooltip:true},
        ],
        groupId: '',
        curGrpName: '',
        type: 1,
      };
    },
    created() {
      this.changeDmgPage();
    },
    mounted: function() {
      this.query();
    },
    computed:{
      remarkA(){
        return this.form.remark;
      },
      extNumberA(){
        return this.form.extNumber;
      },
      addlimitData() {
        // let data = [...this.groupData];
        return this.chooseForm.rightList;
      },
      dataWithAddPage() {
        const data = this.addlimitData;
        const start = this.addPage.pageNum * this.addPage.pageSize - this.addPage.pageSize;
        const end = start + this.addPage.pageSize;
        return [...data].slice(start, end);
      },
    },
    watch:{
      remarkA(val){
        if(val.length>100){
          this.$message.error("描述不能超过100位字符")
          this.form.remark.substring(0,100);
        }
      },
      extNumberA(val){
        if(val.length>10){
          this.$message.error("分机号不能超过10位数字")
          this.form.extNumber.substring(0,10);
        }
      }
    },
    methods: {
      querySearch(){
        this.query(1);
        this.pageNum = 1;
      },
      changeDmgPage(){
        let w = window.screen.width;
        let h = window.screen.height;
        if (w == 1920) {
          if (h == 1080) {
          } else {
            this.pageSize = 11
          }
        }
      },
      //表头样式
      headerCellClassName() {
        return 'font-size:18px;color:#515A6E;padding:10px 0px 10px 0px !important;background:#F5F5F6;border:1px solid #EBEBEB';
      },
      //表格样式
      cellStyleClassName() {
        return 'font-size:13px;text-align:center;color:#606266;padding:5px 0px 5px 0px !important;border:1px solid #EBEBEB';
      },
      closeDialog() {

        this.$nextTick(function() {
          this.$refs['form'].resetFields();
        });
      },
      getExtNumber() {
        this.loadindgExtnum = true;
        InventGroupManage.getExtNumber({type: 1}).then(res => {
          var data = res;
          if (res.success) {
            this.extNumberOptions = data.obj.list;
            this.loadindgExtnum = false;
          } else {
            this.$message(res.msg);
            this.loadindgExtnum = false;
          }
        }).catch(err => {
          // 异常情况
          this.loadindgExtnum = false;
          console.log(err);
        });
      },
      closeTreeDialog() {
        console.info('closeTreeDialog');
        this.loadTree = false;
        this.$nextTick(function() {
          this.loadTree = true;
        });

      },
      handleLeftCheckChange: function(data, checked, indeterminate) {
        console.log(data, checked, indeterminate);
        if (checked) {
          var nodeObj = {};
          nodeObj.id = data.id;
          nodeObj.type = data.type;
          nodeObj.userExtNumber = data.userExtNumber;
          nodeObj.name = data.name;
          nodeObj.extnum = data.userExtNumber;
          var length = false;
          for (let i = 0; i < this.chooseForm.rightList.length; i++) {
            var id = this.chooseForm.rightList[i].id;
            if (data.id === this.chooseForm.rightList[i].id) {
              length = true;
            }
          }
          if (!length) {
            this.chooseForm.rightList.push(nodeObj);
          }
        } else {
          for (let i = 0; i < this.chooseForm.rightList.length; i++) {
            if (data.id === this.chooseForm.rightList[i].id) {
              this.chooseForm.rightList.splice(i, 1);
            }
          }
        }

        for (let i = 0; i < this.chooseForm.rightList.length; i++) {
          var node = this.$refs.tree.getNode(this.chooseForm.rightList[i].id);
          if (node.checked === false) {
            node.checked = true;
          }
        }
      },
      loadChildren: function(node, resolve) {
        if (node.data) {
          if (node.data.type === 2) {
            var childNodes = [];
            return resolve(childNodes);
          } else {
            this.getChild(node.data.id, node.data.type, resolve);
          }
        } else {
          setTimeout(() => {
            this.getChild(this.FleetId, 0, resolve);
          }, 0);
        }
      },
      getChild(id, type, resolve) {
        if (this.chooseForm.seen === true) {
          var jsonData = {
            parentId: id,
            type: type,
            groupId: this.groupId,
          };
          InventGroupManage.getFleetAndSubAndUser(jsonData).then(res => {
            if (res.success) {
              var childNodes = [];
              if (res.obj && res.obj.length > 0) {
                for (let i = 0; i < res.obj.length; i++) {
                  //1：集团，2：终端 ，3：调度员
                  if (res.obj[i].type === 1) {
                    res.obj[i].isLeaf = false;
                    res.obj[i].disabled = true;
                  } else if (res.obj[i].type === 2) {
                    res.obj[i].isLeaf = true;
                    res.obj[i].disabled = true;
                  } else if (res.obj[i].type === 3) {
                    res.obj[i].isLeaf = true;
                    // res.obj[i].disabled = true;
                  }
                }
                childNodes = res.obj;
              } else {
                var node = this.$refs.tree.getNode(id);
                console.log(node);
                node.loading = false;
                node.isLeaf = true;
                return;
              }
              console.log(childNodes);
              resolve(childNodes);
              this.$nextTick(() => {
                for (var i = 0; i < this.chooseForm.rightList.length; i++) {

                  var node = this.$refs.tree.getNode(this.chooseForm.rightList[i].id);
                  if (node !== null) {
                    if (node.checked === false) {
                      node.checked = true;
                    }
                  }
                }
              });
            }
          }).catch(err => {
            // 异常情况
            console.log(err);
          });
        } else {
          var jsonData = {
            parentId: id,
            type: type,
          };
          InventGroupManage.getFleet(jsonData).then(res => {
            if (res.success) {
              var childNodes = [];
              if (res.obj) {
                childNodes = res.obj;
              }
              resolve(childNodes);
            }
          }).catch(err => {
            // 异常情况
            console.log(err);
          });
        }

      },
      filterNode: function(value, data) {
        if (!value)
          return true;
        else
          return data.name.indexOf(value) !== -1;
      },
      loadData: function(node) {
        this.form.fleetName = node.name;
        this.form.fleetId = node.id;
      },

      deleteRightMember: function(id) {
        for (var i = 0; i < this.chooseForm.rightList.length; i++) {
          if (id === this.chooseForm.rightList[i].id) {
            this.chooseForm.rightList.splice(i, 1);
            var node = this.$refs.tree.getNode(id);
            if (node !== null) {
              node.checked = false;

            }
          }
        }
      },
      refreshNodeBy: function(id) {
        var node = this.$refs.tree.getNode(id);
        node.loaded = false;
        node.expand();
      },
      resModify() {
        console.info('resModify');
        var members = [];
        var membersId = '';
        for (var i = 0; i < this.chooseForm.rightList.length; i++) {
          var memberObj = new Object();
          memberObj.subId = this.chooseForm.rightList[i].id;
          //暂时不支持添加调度员
          memberObj.type = this.chooseForm.rightList[i].type;
          memberObj.userExtNumber = this.chooseForm.rightList[i].userExtNumber;
          members[i] = memberObj;
          membersId = memberObj.subId + ',';
        }
        var condition = {
          members: members,
          groupId: this.groupId,

        };
        var auditData = {
          dcId: this.$store.getters.userAccount,
          type: 5,
          status: '成功',
          describe: this.$store.getters.userName + '添加修改该组成员:' + this.curGrpName,
          time: new Date,
          fleetId: this.$store.getters.scsFleetId,
          detailType: 32,
          remark: '',
        };

        InventGroupManage.addInventGroupMember(condition).then(res => {
          if (res.success) {
            this.GlobalFunc.GlaAddAudit(auditData);
            this.$message.success('添加成功');
            this.chooseForm.seen = false;
          } else {
            auditData.status = '失败';
            this.GlobalFunc.GlaAddAudit(auditData);
            this.$message.success('添加成功');
          }
        }).catch(err => {
          // 异常情况
          auditData.status = '异常';
          this.GlobalFunc.GlaAddAudit(auditData);
          console.log(err);
        });

      },

      query: function(pageNum) {
        var data = {
          name: this.name || '',
          pageNum: pageNum || this.pageNum,
          fleetId: this.FleetId,
          pageSize: this.pageSize,
        };
        InventGroupManage.getInventGroup(data).then(res => {
          if (res.success) {
            this.tableData = res.obj.list;
            this.total = res.obj.total;
            this.name = '';
          } else {
            this.$message('查询失败');
          }
        }).catch(err => {
          // 异常情况
          console.log(err);
        });
      },
      getMemberTableData: function(id) {
        InventGroupManage.getMemberTableData({groupId: id}).then(res => {
          var data = res;
          if (res.success) {
            this.chooseForm.rightList = [];
            for (var i = 0; i < res.obj.list.length; i++) {
              var item = new Object();
              item.userExtNumber = res.obj.list[i].userExtNumber;
              item.subId = res.obj.list[i].subId;
              item.id = res.obj.list[i].subId;
              item.type = res.obj.list[i].type;
              item.name = res.obj.list[i].subName;
              item.extnum = res.obj.list[i].extnum;
              this.chooseForm.rightList[i] = item;
            }
            this.showDialog();
          } else {
            this.$message('');
          }
        }).catch(err => {
          // 异常情况
          console.log(err);
        });
      },
      add: function() {
        var that = this;
        that.getExtNumber();
        that.showBox = true;
        that.showAdd = true;
        that.title = '添加';
      },
      addInventGroup: function() {
        var validate = false;
        this.$refs['form'].validate((valid) => {
          if (valid) {
            validate = true;
          } else {
            console.log('error submit!!');
            validate = false;
            return false;
          }
        });
        if (validate === false) {
          return;
        }
        var that = this;
        var data = {
          name: this.form.name,
          // fleetId: this.form.fleetId,
          fleetId: this.FleetId,
          remark: this.form.remark,
          extNumber: that.form.extNumber,
          versionType: 1,
        };
        if (data.extNumber.length > 20) {
          this.$message.error('IP分机号码长度不能超过20个字符！');
          return;
        }
        var auditData = {
          dcId: this.$store.getters.userAccount,
          type: 5,
          status: '成功',
          describe: this.$store.getters.userName + '添加虚拟组:' + data.name,
          time: new Date,
          fleetId: this.$store.getters.scsFleetId,
          detailType: 32,
          remark: '',
        };
        InventGroupManage.addInventGroup(data).then(res => {
          if (res.success) {
            let row = res.obj.count;
            if (row) {
              switch (row) {
                case 1 ://添加修改成功
                  this.GlobalFunc.GlaAddAudit(auditData);

                  that.closeBox();
                  that.$message.success('添加成功');
                  that.query();
                  break;
                case 2 ://分机号已被使用
                  auditData.status = '分机号已被使用';
                  this.GlobalFunc.GlaAddAudit(auditData);

                  this.$message.error('分机号已被使用');
                  break;
                case 3 ://分机号类型错误
                  auditData.status = '失败:分机号类型错误';
                  this.GlobalFunc.GlaAddAudit(auditData);
                  this.$message.error('分机号类型错误');
                  break;
                case 4 ://非分机号
                  auditData.status = '失败:编组名称重复';
                  this.$message.error('编组名称重复');
                  break;
              }
            }

          } else {
            auditData.status = '失败';
            this.GlobalFunc.GlaAddAudit(auditData);

            that.$message('添加失败');
          }
        }).catch(err => {
          // 异常情况
          auditData.status = '异常';

          console.log(err);
        });
      },
      updateInventGroup: function() {
        var validate = false;
        this.$refs['form'].validate((valid) => {
          if (valid) {
            validate = true;
          } else {
            console.log('error submit!!');
            validate = false;
            return false;
          }
        });
        if (validate === false) {
          return;
        }
        var data = {
          id: this.form.id,
          name: this.form.name,
          // fleetId: this.form.fleetId,
          fleetId: this.FleetId,
          remark: this.form.remark,
          extNumber: this.form.extNumber,
          versionType: 1,
        };
        if (data.extNumber.length > 20) {
          this.$message.error('IP分机号码长度不能超过20个字符！');
          return;
        }
        var auditData = {
          dcId: this.$store.getters.userAccount,
          type: 5,
          status: '成功',
          describe: this.$store.getters.userName + '修改虚拟组:' + data.name,
          time: new Date,
          fleetId: this.$store.getters.scsFleetId,
          detailType: 32,
          remark: '',
        };
        InventGroupManage.updateInventGroup(data).then(res => {
          if (res.success) {
            let row = res.obj.count;
            if (row) {
              switch (row) {
                case 1 ://添加修改成功
                  this.GlobalFunc.GlaAddAudit(auditData);
                  this.closeBox();
                  this.$message.success('编辑成功');
                  this.query();
                  // this.chooseForm.seen = false;
                  break;
                case 2 ://分机号已被使用
                  auditData.status = '分机号已被使用';
                  this.GlobalFunc.GlaAddAudit(auditData);
                  this.$message.error('分机号已被使用');
                  break;
                case 3 ://分机号类型错误
                  auditData.status = '失败:分机号类型错误';
                  this.GlobalFunc.GlaAddAudit(auditData);
                  this.$message.error('分机号类型错误');
                  break;
                case 4 ://非分机号
                  auditData.status = '失败:编组名称重复';
                  this.$message.error('编组名称重复');
                  break;
              }
            }

          } else {
            this.$message('编辑失败');
            auditData.status = '失败';
            this.GlobalFunc.GlaAddAudit(auditData);
          }
        }).catch(err => {
          // 异常情况
          console.log(err);
          auditData.status = '异常';
          this.GlobalFunc.GlaAddAudit(auditData);
        });
      },
      closeBox: function() {
        this.showAdd = false;
        this.showBox = false;
        this.chooseForm.seen = false;
      },
      showDialog() {
        this.chooseForm.seen = true;
      },
      operate(row, href) {
        if (href.indexOf('update') !== -1) {
          this.getExtNumber();
          this.showBox = true;
          this.showAdd = false;
          this.title = '编辑';
          this.form.id = row.id;
          this.form.name = row.name;
          //  that.form.fleetName = row.fleetName;
          this.form.fleetId = row.fleetId;
          this.form.remark = row.remark;
          this.form.extNumber = row.extNumber;

        } else if (href.indexOf('delete') !== -1) {
          var auditData = {
            dcId: this.$store.getters.userAccount,
            type: 5,
            status: '成功',
            describe: this.$store.getters.userName + '删除虚拟组:' + row.name,
            time: new Date,
            fleetId: this.$store.getters.scsFleetId,
            detailType: 32,
            remark: '',
          };
          this.$confirm('是否确定删除', '', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
          }).then(() => {
            InventGroupManage.deleteInventGroup({id: row.id}).then(res => {
              if (res.success) {
                this.GlobalFunc.GlaAddAudit(auditData);
                this.$message.success('删除成功');
                //此时已经实现删除操作，所以total的值需要减1，Math.ceil是向上取整，保证始终大于等于1
                const totalPage = Math.ceil((this.total - 1) / this.pageSize);
                //记住删除最后一条数据时当前码是最后一页
                const tempPageNum = this.pageNum > totalPage ? totalPage : this.pageNum;
                //实现跳转
                this.pageNum = tempPageNum < 1 ? 1 : tempPageNum;
                this.query();
              } else {
                auditData.status = '失败';
                this.GlobalFunc.GlaAddAudit(auditData);
              }
            }).catch(err => {
              // 异常情况
              auditData.status = '异常';
              this.GlobalFunc.GlaAddAudit(auditData);
              console.log(err);
            });
          }).catch(() => {
          });

        } else {
          this.chooseForm.seen = true;
          this.title = '成员管理';
          this.groupId = row.id;
          this.curGrpName = row.name;
          this.getMemberTableData(row.id);
        }
      },
      deleteInventGroupMember: function(row) {
        var that = this;
        InventGroupManage.deleteInventGroupMember({subId: row.subId, groupId: row.groupId}).then(res => {
          if (res.success) {
            that.$message.success('删除成功');
            that.getMemberTableData(row.groupId);
            that.refreshNodeBy(this.FleetId);
          }
        }).catch(err => {
          // 异常情况
          console.log(err);
        });
      },
      changePageNum: function(val) {
        this.pageNum = val;
        this.query();
      },
      changesAddPageNum: function(val) {
        this.addPage.pageNum = val;
      },
      /*loadFleetAndSubAndUser: function (node, resolve) {
        var that =this;
        if(node.data && node.data.type ===1){
          that.getFleetAndSubAndUser(node.data.id , node.data.type ,resolve);
        }else{
          setTimeout(function(){ that.getFleetAndSubAndUser( window.fleetId , 0 ,resolve);}, 0);
        }
      },
      getFleetAndSubAndUser: function (id, type,resolve) {
        var jsonData={
          parentId:id,
          type:type,
          groupId:this.groupId
        };
        InventGroupManage.getFleetAndSubAndUser(jsonData)
        .then(res => {
          if(res.success){
            var childNodes = [];
            if (res.obj) {
              childNodes = res.obj;
            }
            resolve(childNodes);
          }
        }).catch(err => {
          // 异常情况
          console.log(err);
        });
      },
      handleCheckChange:function(data) {
        if(data.type===2 || data.type===3){
          var that=this;
          InventGroupManage.addInventGroupMember({groupId:that.groupId,subId:data.id,type:data.type})
          .then(res => {
            if(res.success){
              if(res.obj.count===1){
                that.$message.success('添加成功');
                that.getMemberTableData(that.groupId);
                that.refreshNodeBy(window.fleetId);
              }else{
                that.$message('错误码'+res.obj.count);
              }
            }else{
              that.$message('内部错误');
            }
          }).catch(err => {
            // 异常情况
            console.log(err);
          });
        }
      },

      formClear:function () {
        this.form.id='';
        this.form.name='';
        this.form.fleetId='';
        this.form.fleetName='';
        this.form.remark='';
      },*/

    },
  };
</script>

<style scoped>
    .el-dialog__body {
        /*height: 30vh;*/
        overflow: auto;
    }
   /deep/ .el-icon-caret-right:before {
        font-size: 40px!important;
    }
    /deep/ .el-checkbox {
        height: 30px;
        width: 30px;
    }

    /deep/ .el-checkbox__inner {
        width: 30px;
        height: 30px;
    }

    /deep/ .el-checkbox /deep/ .el-checkbox__inner {
        height: 30px;
        width: 30px;
    }

    /deep/ .el-checkbox /deep/ .el-checkbox__input {
        vertical-align: middle!important;
    }

    /deep/ .el-checkbox /deep/ .el-checkbox__inner:before {
        font-size: 20px;
        margin: 3px auto auto 3px;
        text-align: center;
        line-height: 40px;
    }

    /deep/ .el-checkbox /deep/ .el-checkbox__inner:after {
        height: 12px;
        width: 12px;
        font-size: 20px;
        margin: 3px auto auto 3px;
        text-align: center;
        /*line-height: 40px;*/
    }
    /deep/ .el-tree-node__content {
        height: 40px !important;
    }

    /deep/ .el-form-item__label {
        font-size: 22px!important;
    }

    /deep/ .el-input__inner {
        font-size: 22px!important;
    }
    /deep/ .el-dialog__title {
        font-size: 22px;
    }
    /deep/ .el-icon-close:before {
        font-size: 25px;
    }

    /*   >>>.el-checkbox__input > .el-checkbox__inner  {
           display: none;
       }
      >>> .is-leaf +.el-checkbox .el-checkbox__inner {
           display: inline-block;
       }*/
    /* /deep/ .el-checkbox__input > .el-checkbox__inner {
         display: none;
     }

     /deep/ .is-leaf + .el-checkbox .el-checkbox__inner {
         display: inline-block;
     }*/
    /*分页修改开始*/
    .el-pagination /deep/ .el-pagination__total {
        font-size: 20px;
        line-height: 60px;
    }.el-pagination /deep/ button /deep/ .el-icon .el-icon .el-icon-arrow-left {
         font-size: 50px;
         height: 60px;
         width: 40px;
     }
    /deep/ .el-pager li{
         margin-top: 15px;
         height: 60px;
         width: 60px;
         line-height: 60px;
         font-size: 18px;
     }
    /deep/  .el-pagination.is-background .btn-prev, .el-pager li{
        height: 60px;
        width: 60px;
    }/deep/ .el-pagination.is-background .btn-next, .el-pager li{
         height: 60px;
         width: 60px;
     }/deep/ .el-pagination .btn-prev  .el-icon{
          font-size: 40px;
      }/deep/ .el-pagination .btn-next .el-icon{
           font-size: 40px;
       }
    /*分页修改结束*/

    #inventGroupManage .table-wrap {
        height: 760px !important;
        overflow: auto;
    }

    @media (max-width: 1366px) {
        #inventGroupManage .table-wrap {
            height: 800px !important;
            overflow: auto;
        }
    }

    .searchFormBtn {
        margin-left: 5px;
        display: inline-block;
    }
    .groupMgStyleBigBoxLeft{
        float:left;
        width:40%;
        height:450px
    }
    .groupMgStyleBigBox {
        float: right;
        width: 60%;
        height: 450px;
        background: ghostwhite;
        overflow-y: auto;
        overflow-x: hidden;
    }

</style>
